import { ecs } from "db://oops-framework/libs/ecs/ECS";
import { LeaderModelComp } from "./model/LeaderModelComp";
import { LeaderUpgradeComp, LeaderUpgradeSystem } from "./bll/LeaderUpgrade";
import { LeaderModelLevelComp } from "./model/LeaderModelLevelComp";

/** 
 * 主角实体 
 */
@ecs.register('Leader')
export class Leader extends ecs.Entity {
    // 数据层
    LeaderModel!: LeaderModelComp;
    LeaderModelLevel!: LeaderModelLevelComp;

    protected init() {
        this.addComponents<ecs.Comp>(
            LeaderModelComp,
            LeaderModelLevelComp,
        );
    }
    setLevel(lv: number) {
        var ru = this.add(LeaderUpgradeComp);
        ru.lv = lv;
        ru.type = 0;
    }
    destroy(): void {
        this.remove(LeaderModelComp);
        this.remove(LeaderModelLevelComp);
        
        super.destroy();
    }
}
export class EcsLeaderSystem extends ecs.System {
    constructor() {
        super();

        this.add(new LeaderUpgradeSystem());
        // this.add(new CheckLeaderStageUpBllSystem());
    }
}